var t = getApp();

Page({
    data: {
        language: "",
        goodsData: [],
        dataState: 0,
        showEdit: !1,
        indicatorDots: !0,
        vertical: !1,
        autoplay: !0,
        interval: 4e3,
        duration: 300,
        integral: "积分",
        page: 1,
        finisend: !1
    },
    delData: function(a) {
        var e = this, o = t.getNetAddresss("member.member-history.destroy");
        console.log(a.currentTarget.dataset.id), o += "&id=" + a.currentTarget.dataset.id, 
        wx.showModal({
            title: "提示",
            content: "确定要删除足迹么？此操作不可逆！",
            success: function(s) {
                s.confirm && (console.log("用户点击确定"), t._getNetWork({
                    url: o,
                    success: function(t) {
                        var o = t.data;
                        if (console.log("_data", o), 1 == o.result) {
                            for (var s = 0; s < e.data.goodsData.length; s++) console.log(e.data.goodsData[s]), 
                            e.data.goodsData[s].id == a.currentTarget.dataset.id && e.data.goodsData.splice(s, 1);
                            e.setData({
                                goodsData: e.data.goodsData
                            }), wx.showToast({
                                title: o.msg,
                                icon: "success",
                                duration: 2e3,
                                success: function() {},
                                fail: function() {}
                            });
                        } else wx.showToast({
                            title: "数据错误",
                            icon: "success",
                            duration: 2e3,
                            success: function() {},
                            fail: function() {}
                        });
                    },
                    fail: function(t) {}
                }));
            }
        });
    },
    goDetail: function(t) {
        var a = t.currentTarget.dataset.itemdata;
        0 != a.owner_id || wx.navigateTo({
            url: "/packageA/detail_v2/detail_v2?id=" + a.goods.id
        });
    },
    _getData: function() {
        if (!this.data.finisend) {
            var a = this, e = t.getNetAddresss("member.member-history.index");
            1 == t.globalData.store_alone_temp && (e = t.getNetAddresss("plugin.store-alone-temp.frontend.member.history-list")), 
            t._getNetWork({
                url: e,
                data: {
                    page: this.data.page
                },
                showToastIn: !1,
                success: function(t) {
                    var e = t.data;
                    if (1 == e.result) {
                        var o = !1, s = [];
                        console.log(e), o = a.data.page >= e.data.last_page || e.data.member_histories.legnth < e.data.per_page, 
                        s = a.data.page > 1 ? a.data.goodsData.concat(e.data.member_histories) : e.data.member_histories, 
                        a.setData({
                            goodsData: s,
                            finisend: o,
                            page: ++a.data.page
                        });
                    } else wx.showToast({
                        title: t.data.msg,
                        icon: "none",
                        duration: 2e3
                    });
                },
                fail: function(t) {}
            });
        }
    },
    onReady: function() {
        var t = wx.getStorageSync("langIndex");
        this.setData({
            language: t.en
        });
        var a = wx.getStorageSync("integral");
        a && this.setData({
            integral: a
        });
    },
    onShow: function() {
        this.setData({
            page: 1,
            finisend: !1
        }), this._getData();
    },
    onHide: function() {},
    onUnload: function() {},
    onReachBottom: function() {
        this._getData();
    }
});